package com.poem.config;

import com.poem.interceptor.JwtTokenUserterceptor;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @ClassName: WebMvcConfiguration
 * @Author: YLY
 * @Description:
 * @Date: 2025/10/30
 * @Version: 1.0
 */
@Configuration
@Slf4j
public class WebMvcConfiguration extends WebMvcConfigurationSupport {

    @Resource
    private JwtTokenUserterceptor jwtTokenUserterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry  registry){
        log.info("开始注册自定义拦截器");

        registry.addInterceptor(jwtTokenUserterceptor)
                .addPathPatterns("/**")
                .excludePathPatterns("/auth/login","/auth/register");
    }
}
